package main

import (
	"github.com/gin-gonic/gin"
	"go.uber.org/zap"
)

func main(){
	r:=gin.Default()
	r.Use(func(c *gin.Context) {
		logger,err:=zap.NewProduction()
		if err!=nil {
			panic(err)
		}

		c.Next()
		logger.Info("path",zap.String("path",c.Request.URL.Path),zap.Int("status",c.Writer.Status()))
	})
	r.GET("/ping", func(c *gin.Context) {
		c.JSON(200,gin.H{
			"message":"pong",
		})
	})
	r.Run()
}
